home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / AppsToGo / AppsToGo.src / DTS.Lib / CDEFs / DataCDEF.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-18  |  2.3 KB  |  111 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** Program:         datacontrol.c
  5. ** Written by:      Eric Soldan
  6. **
  7. ** Copyright © 1992 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* Data control theory of operation:
  12. **
  13. ** The Data control is used simply as a data holder for data related to a window.
  14. ** The advantage to using this control is that when the window is disposed of,
  15. ** the data is automatically disposed of.  This allows you to create a handle for
  16. ** storage of auxiliary window data and not have to worry about its disposal. */
  17.  
  18. /* The Data control is always invisible, inactive, and non-hittable.  As it does nothing,
  19. ** you can use most fields for storage of information.  The fields you can use are:
  20. **
  21. ** struct ControlRecord {
  22. **    struct ControlRecord **nextControl;
  23. **    WindowPtr contrlOwner;
  24. **    Rect contrlRect;                        can use
  25. **    unsigned char contrlVis;
  26. **    unsigned char contrlHilite;
  27. **    short contrlValue;                    can use
  28. **    short contrlMin;                        can use
  29. **    short contrlMax;                        can use
  30. **    Handle contrlDefProc;
  31. **    Handle contrlData;                    can use to store a handle
  32. **    ProcPtr contrlAction;
  33. **    long contrlRfCon;                        can use
  34. **    Str255 contrlTitle;                    can use
  35. ** };
  36. **
  37. ** The contrlData field is either nil or it holds a handle.  If not nil, then the
  38. ** handle is dispose of when the control is disposed of. */
  39.  
  40.  
  41.  
  42. /*****************************************************************************/
  43.  
  44.  
  45.  
  46. #ifndef __CONTROLS__
  47. #include <Controls.h>
  48. #endif
  49.  
  50. #ifndef __MEMORY__
  51. #include <Memory.h>
  52. #endif
  53.  
  54.  
  55.  
  56. pascal long        CDataCtl   (short varCode, ControlHandle ctl, short msg, long parm);
  57.  
  58.  
  59.  
  60. /*****************************************************************************/
  61.  
  62.  
  63.  
  64. #pragma segment DataCDEF
  65. pascal long    CDataCtl(short varCode, ControlHandle ctl, short msg, long parm)
  66. {
  67. #pragma unused (varCode)
  68.  
  69.     switch (msg) {
  70.  
  71.         case drawCntl:
  72.             break;
  73.  
  74.         case testCntl:
  75.             break;
  76.  
  77.         case calcCRgns:
  78.         case calcCntlRgn:
  79.             if (msg == calcCRgns)
  80.                 parm &= 0x00FFFFFF;
  81.             SetRectRgn((RgnHandle)parm, 0, 0, 0, 0);
  82.             break;
  83.  
  84.         case initCntl:
  85.             (*ctl)->contrlData = nil;
  86.             break;
  87.  
  88.         case dispCntl:
  89.             if ((*ctl)->contrlData)
  90.                 DisposeHandle((Handle)(*ctl)->contrlData);
  91.             break;
  92.  
  93.         case posCntl:
  94.             break;
  95.  
  96.         case thumbCntl:
  97.             break;
  98.  
  99.         case dragCntl:
  100.             break;
  101.  
  102.         case autoTrack:
  103.             break;
  104.     }
  105.  
  106.     return(0);
  107. }
  108.  
  109.  
  110.  
  111.